{extend name="platform/base" /} 
{block name="main"}
<section class="panel panel-default">
	<header class="panel-heading font-bold"> 添加类型 </header>
	<div class="panel-body">
		<form class="form-horizontal" id="addreporttopic_form" name="form">
		
			<div class="form-group">
				<label class="col-sm-2 control-label">举报类型</label>
				<!-- 				
				<div class="col-sm-2">
					<select name="attr" id="attr_id" style="width:100%;height:30px;border-color:#d9d9d9;color:#555555;">
						<option value="">选择类型</option>
						{volist name="reporttopiclist" id="vo"}
						<option value="{$vo['inform_type_id']}">{$vo['inform_type_name']}</option>
						{/volist}
					</select>
				</div> 
				-->			
				<div class="col-md-10">

				{volist name="reporttopiclist" id="vo"}
					<label class="radio inline col-md-12">
					<input type="radio" name="inform_subject_type_id" inform_subject_type_name="{$vo['inform_type_name']}"  value="{$vo['inform_type_id']}" {eq name="i" value="1"}checked="checked"{/eq}>{$vo['inform_type_name']}
					</label> 					
				{/volist}

				</div>	
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			
			<!-- <div class="form-group">
				<label class="col-sm-2 control-label"></label>
				<div class="col-md-10">

				{volist name="reporttopiclist" id="vo"}
					<label class="radio inline col-md-12">
					<input type="radio" name="inform_subject_type_id" inform_subject_type_name="{$vo['inform_type_name']}"  value="{$vo['inform_type_id']}" {eq name="i" value="1"}checked="checked"{/eq}>{$vo['inform_type_name']}
					</label> 					
				{/volist}

				</div>
			</div>			
		    <div class="line line-dashed line-lg pull-in"></div> -->
		
			<div class="form-group">
				<label class="col-sm-2 control-label"><span class="color-red">*</span>举报主题</label>
				<div class="col-md-2">
					<input type="text" class="form-control" id="inform_subject_content" name="inform_subject_content" required value="" onkeydown="error_hide()">
				</div>
				<p class="error">举报主题不能为空</p>
			</div>

			<!-- 书签 -->
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<div class="col-sm-4 col-sm-offset-2">
					<!-- <button type="submit" class="btn btn-primary">保存</button> -->
					<a href="javascript:void(0);" onclick="addReportTopicAjax()" class="btn btn-primary">保存</a>
				</div>
			</div>
		</form>
	</div>
</section>
<script>
	// $().ready(function() {

	// 	$("#addreporttopic_form").validate({
	// 		submitHandler : function() {
	// 			addReportTopicAjax();
	// 		}
	// 	});
	// });
	/**
	 *添加模块
	 */
		function addReportTopicAjax()
		{
			var inform_subject_type_name = $("input:radio:checked").attr("inform_subject_type_name");
			var inform_subject_type_id = $("input:radio:checked").val();
			if(inform_subject_type_id == undefined){
				showMessage('error', "举报类型不能为空！");
				return false;
			}

			var inform_subject_content = $("#inform_subject_content").val();
			if(inform_subject_content == ''){
				$("#inform_subject_content").focus().parent().next().show();
				return false;
			}
		$.ajax({
			type : "post",
			data : {
				'inform_subject_type_id' : inform_subject_type_id,
				'inform_subject_type_name' : inform_subject_type_name,
				'inform_subject_content' : inform_subject_content
			},
			async : true,
			success : function(data) {				
				if (data["code"] > 0) {
					showMessage('success', data["message"],'{:__URL("PLATFORM_MAIN/report/reporttopiclist")}');	
				} else {
					showMessage('error', data["message"]);
				}
			}
		});
	}

</script>
{/block}